package com.zhangzhibo.service.user;

import com.zhangzhibo.dao.user.UserMapper;
import com.zhangzhibo.pojo.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserServiceImpl implements UserService{
    @Autowired
    @Qualifier("userMapper")
    private UserMapper user;

    public void setUser(UserMapper user) {
        this.user = user;
    }

    @Override
    public User getLoginInfo(String userCode, String OperationName, int id) {
        return user.getLoginInfo(userCode,OperationName,id);
    }

    @Override
    public int updatePassword(int id, String newPsd) {
        return user.updatePassword(id,newPsd);
    }

    @Override
    public int getUserCounts(String username, int userRole) {
        return user.getUserCounts(username,userRole);
    }

    @Override
    public List<User> getUserList(String username, int userRole, int currentPageNo, int pageSize) {
        return user.getUserList(username,userRole,currentPageNo,pageSize);
    }

    @Override
    public int addUser(User user) {
        return this.user.addUser(user);
    }

    @Override
    public int deleteUser(int userId) {
        return user.deleteUser(userId);
    }

    @Override
    public User findById(int userId) {
        return user.findById(userId);
    }

    @Override
    public int modify(User user) {
        return this.user.modify(user);
    }

    @Override
    public List<User> getAllUser() {
        return user.getAllUser();
    }
}
